<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>按钮示例</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }
        .container {
            position: relative;
            text-align: center;
        }
        .button {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: #4CAF50;
            color: white;
            border: none;
            cursor: pointer;
            font-size: 20px;
            position: absolute;
            transition: background-color 0.3s; /* 添加过渡效果 */
        }
        .up { top: -120px; left: 50%; transform: translateX(-50%); }
        .down { bottom: -120px; left: 50%; transform: translateX(-50%); }
        .left { left: -120px; top: 50%; transform: translateY(-50%); }
        .right { right: -120px; top: 50%; transform: translateY(-50%); }
        .start-button {
            margin: 20px;
            padding: 10px 20px;
            font-size: 20px;
            cursor: pointer;
        }
    </style>
</head>
<body>

<div class="container">
    <button class="button up" onclick="changeColor(this)">↑</button>
    <button class="button down" onclick="changeColor(this)">↓</button>
    <button class="button left" onclick="changeColor(this)">←</button>
    <button class="button right" onclick="changeColor(this)">→</button>
    <button class="start-button" onclick="startSequence()">开始</button>
</div>

<script>
    function changeColor(button) {
        button.style.backgroundColor = "#FF5733"; // 点击后变为红色
        setTimeout(() => {
            button.style.backgroundColor = "#4CAF50"; // 0.5秒后恢复原色
        }, 500);
    }

    function startSequence() {
        const messages = [
            "环割中......",
            "环割完成！"
        ];
        
        let index = 0;

        function showNextMessage() {
            if (index < messages.length) {
                alert(messages[index]);
                index++;
                setTimeout(showNextMessage, 3000); // 每个提示框间隔3秒
            } 
        }

        showNextMessage();
    }
</script>

</body>
</html>
